
function SimpleInputBoxValidate(element, label){
	return '';
}

function SimpleTextAreaValidate(element, label){
	return '';
}

function DateBoxValidate(element, label){
	if(isDate(element.value)){
		return '';
	} else {
		return '- Please enter a valid date for ' + formatLabel(label) + '\n';
	}
}

function DropDownValidate(element, label){
	return '';
}

function CheckBoxValidate(element, label){
	return '';
}

function MysqlDateBoxValidate(element, label){
	return DateBoxValidate(element, label);
}

function SimpleCurrencyBoxValidate(element, label){
	if(IsNumeric(element.value)){
		return '';
	} else {
		return '- Please enter a valid number for ' + formatLabel(label) + '\n';
	}

}

function SimpleNumericBoxValidate(element, label){
	if(IsNumeric(element.value)){
		return '';
	} else {
		return '- Please enter a valid number for ' + formatLabel(label) + '\n';
	}
}

function SimpleMultiSelectValidate(element, label){
	return '';
}

function PhoneNumberInputBoxValidate(element, label){
	if(isPhoneNumber(element.value)){
		return '';
	} else {
		return '- Please enter a valid phone number for ' + formatLabel(label) + '\n';
	}

}

function SimplePasswordValidate(element, label){
	if (document.getElementById("cPass").value == "true") {
		// There is a confirmation box
		if (document.getElementById(document.getElementById("pccol").value).value == element.value){
			return '';			
		} else {
			return document.getElementById("confirmPasswordMessage").value;
		}
	} else {
		return '';
	}
}
function XUploadValidate(element, label){
	return '';
}
function StarsRatingValidate(element, label){
	return '';
}
function MapLocalizerValidate(element, label){
	return '';
}
function ListDropDownValidate(element, label){
	return '';
}
function HTMLAreaValidate(element, label){
	element.value = editor.getHTML();
	/*if (document.forms[0].onsubmit){
		document.forms[0].onsubmit();
	}*/
	return '';
}
function SimpleEmailInputValidate(element, label){
	if (isValidEmail(element.value)){
		return '';
	} else {
		return 'Invalid email address';
	}
}

function ParseUSNumber(PhoneNumberInitialString){
    var FmtStr="";
    var index = 0;
    var LimitCheck;

    LimitCheck = PhoneNumberInitialString.length;
    while (index != LimitCheck){
        if (isNaN(parseInt(PhoneNumberInitialString.charAt(index)))){ 
			// Nothing to do.
		} else { 
			FmtStr = FmtStr + PhoneNumberInitialString.charAt(index); 
		}
        index = index + 1;
    }
    if (FmtStr.length == 10){
        FmtStr = "(" + FmtStr.substring(0,3) + ") " + FmtStr.substring(3,6) + "-" + FmtStr.substring(6,10);
      } else{
        	FmtStr=PhoneNumberInitialString;
    }
    return FmtStr;
}

function isValidZipCode(value) {
   var re = /^\d{5}([\-]\d{4})?$/;
   return (re.test(value));
}

function isValidEmail(str) {
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
		return true;
	} else {
		if (str == ""){
			return true;
		} else {
			return false;
		}
	}
}
